<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('order_sequences', function (Blueprint $table) {
            $table->id();
            // YYYYMMDD 格式的日期键
            $table->string('date', 8)->unique()->comment('日期键，格式YYYYMMDD');
            // 当日自增序号
            $table->unsignedInteger('seq')->default(0)->comment('当日自增序号');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('order_sequences');
    }
};
